package test;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : example
 * @ Author: XuLeHuang
 * @ Date: 2022/11/18 11:03
 * @ Description:
 */
@Component
@Slf4j
public class VarGetUtil {
    @Autowired
    private Environment environment;
    @PostConstruct
    public void getVarFromEnvironment() {
        String abcFromEnv = environment.getProperty("abc");
        String abcFromSys = System.getProperty("abc");
        log.info("abc的值：{}" , abcFromEnv);
        log.info("abc的值：{}" , abcFromSys);
    }
}
